<?php 

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_data_ = "SELECT DISTINCT jenis FROM artikel ORDER BY id DESC";
$data_ = mysql_query($query_data_, $sepolwan_connect) or die(mysql_error());
$row_data_ = mysql_fetch_assoc($data_);

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_data_terkomentari = "SELECT * FROM artikel ORDER BY comment DESC LIMIT 4";
$data_terkomentari = mysql_query($query_data_terkomentari, $sepolwan_connect) or die(mysql_error());
$row_data_terkomentari = mysql_fetch_assoc($data_terkomentari);

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_data_terpopuler = "SELECT * FROM artikel ORDER BY view DESC LIMIT 4";
$data_terpopuler = mysql_query($query_data_terpopuler, $sepolwan_connect) or die(mysql_error());
$row_data_terpopuler = mysql_fetch_assoc($data_terpopuler);

?>
<p>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="624" valign="top" ><div id="halaman"><div class="jusul"><?php echo str_replace('-', ' ',$_GET['sub']); ?></div>
    
    <div id="wrapper">
         <div id="pageData"></div>
    </div>
    </div></td>
    <td width="10"></td>
    <td width="316" valign="top"><div id="halaman"><div class="jusul">Popular</div>
    <?php do { ?>
          <div style="width:100%; height:70px; margin-top:10px; text-align:justify"><strong><a href="<?php echo $base ?>detail-<?php echo $row_data_terpopuler['id']; ?>/<?php echo str_replace(array(' ', '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '{', '}', '|', ',', ':', ';', '"', '<', '>', ',', '.', '?', '/'), '-', $row_data_terpopuler['judul']); ?>.html"><?php echo $row_data_terpopuler['judul']; ?></a></strong><br />
  <?php echo tgl_indo($row_data_terpopuler['waktu']); ?></div><div style="width:100%; height:1px; background:#CCC;"></div>
  <?php } while ($row_data_terpopuler = mysql_fetch_assoc($data_terpopuler)); ?></div>
  <br />
  <div id="halaman"><div class="jusul">Comments</div>
  <?php do { ?>
          <div style="width:100%; height:70px; margin-top:10px; text-align:justify"><strong><a href="<?php echo $base ?>detail-<?php echo $row_data_terkomentari['id']; ?>/<?php echo str_replace(array(' ', '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '{', '}', '|', ',', ':', ';', '"', '<', '>', ',', '.', '?', '/'), '-', $row_data_terkomentari['judul']); ?>.html"><?php echo $row_data_terkomentari['judul']; ?></a></strong><br />
  <?php echo tgl_indo($row_data_terkomentari['waktu']); ?></div><div style="width:100%; height:1px; background:#CCC;"></div>
  <?php } while ($row_data_terkomentari = mysql_fetch_assoc($data_terkomentari)); ?>
  
  </div>
  <br />
  <div id="halaman">
    <div class="jusul">Tags</div>
  <div style="text-align:justify"><?php do { ?>
  <a href="<?php echo $base ?>halaman/artikel/<?php echo $row_data_['jenis']; ?>.html"><?php echo str_replace('-', ' ', $row_data_['jenis']); ?></a> , 
  <?php } while ($row_data_ = mysql_fetch_assoc($data_)); ?>
  </div>
  </div>
  </td>
  </tr>
</table></p>